package com.library.admin.service;

import javax.annotation.PostConstruct;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import books.borrowing.EJBFacade;
import books.borrowing.bo.IAuthorManagerClientService;
import books.borrowing.bo.IBookBorrowingBo;
import books.borrowing.bo.IBookManagerClientService;
import books.borrowing.bo.ISubscriberBo;

@Component
@Scope("session")
public class LibraryService {
    private static IBookManagerClientService 	_serviceBook;
    private static IAuthorManagerClientService 	_serviceAuthor;
    private static ISubscriberBo 				_serviceSubscriber;
    private static IBookBorrowingBo				_serviceBorrowing;
    
    @PostConstruct
    public void init() {
    	EJBFacade.getInstance();
    	_serviceBook = 			EJBFacade.getBooksManager();
    	_serviceAuthor = 		EJBFacade.getAuthorManager();
    	_serviceSubscriber = 	EJBFacade.getSubscriberBo();
    	_serviceBorrowing = 	EJBFacade.getBookBorrowingBo();
    }

	public static IBookManagerClientService getServiceBook() {
		return _serviceBook;
	}

	public static IAuthorManagerClientService getServiceAuthor() {
		return _serviceAuthor;
	}

	public static ISubscriberBo getServiceSubscriber() {
		return _serviceSubscriber;
	}

	public static IBookBorrowingBo getServiceBorrowing() {
		return _serviceBorrowing;
	}
}
